﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MoneyDistr.Question;

namespace MoneyDistribution.Answer
{
    public class Edward : IMoneyDistr
    {
        public long GetCount(int n, int[] Base)
        {
           

            return n<10?Method3(n):Method3(n);
        }

        long Method1(int n)
        {
            long count = 0;
            int remainder = 0;
            remainder = n % 7;
            count = n / 7;
            n = remainder;
            if (n < 5)
            {
                count -= 1;
                n += 7;
            }
            remainder = n % 5;
            count += n / 5;
            count += remainder;
            return count;
        }

        long Method3(int n)
        {
            long count = 0;
            while (n > 0)
            {
                if (n >= 7)
                {
                    n -= 7;
                    count++;
                }
                if (n >= 5)
                {
                    n -= 5;
                    count++;
                }
                if ((n < 5) && (n > 0))
                {
                    n -= 1;
                    count++;
                }
            }

            return count;
        }
    }
}
